<template>
  <div>
    <el-row class="header">
      <el-col :span="12" class="header-left">
        <div class="logo">
          <router-link tag="img" class="logo-image" :src="logoImageResource" to="/"></router-link>
        </div>
        <div class="pcrs-text" @click="gotoHomePage">
          {{title}}
        </div>
      </el-col>
      <el-col :span="12" class="header-right">
        <div class="user-label">
          <div>
            <span class="welcome-text">Welcome:</span>
            <span class="user-name">{{username}}</span>
          </div>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import logoImageResource from '@/common/images/oocl_logo.png'

export default {
  props: {
    title: {
      default: 'PCRS',
      type: String
    },
    username: {
      default: '',
      type: String
    }
  },
  data() {
    return {
      logoImageResource: logoImageResource
    }
  },
  methods: {
    gotoHomePage() {
      this.$router.push({ path: '/' })
    }
  }
}
</script>

<style scoped>
  .header {
    background-color: #5a9fd2;
    height: 70px;
    color: white;
  }

  .header-left {
    height: 100%;
    display: flex;
    align-items: center;
  }

  .logo {
    margin: 0 30px 0 15px;
  }

  .pcrs-text {
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
  }

  .user-label {
    margin: 20px 35px 0 0;
    padding-top: 10px;
    text-align: right;
    font-weight: bold;
  }

  .user-name {
    font-size: 16px;
  }

  .logo-image {
    cursor: pointer;
  }

  .welcome-text {
    font-size: 14px;
    margin-right: 10px;
    font-weight: bold;
  }

</style>
